import { fly } from '@/api/utils/flyio';

export default class Basis {
  constructor() {
    const args = Array.prototype.slice.call(arguments);
    const find = args.find(item => fly.constructor === item);
    this.fly = find ? find : fly;
  }

  /**
   * GET请求
   * @param { string } url
   * @param { Object? } data
   * @param { FlyRequestConfig? } config
   * @returns {FlyPromise<any>}
   */
  get(url, data, config) {
    return this.fly.get(url, data, config);
  }

  /**
   * POST请求
   * @param { string } url
   * @param { Object? } data
   * @param { FlyRequestConfig? } config
   * @returns {FlyPromise<any>}
   */
  post(url, data, config) {
    return this.fly.post(url, data, config);
  }
}
